package org.tloss.web.spring;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

@XmlAccessorType(XmlAccessType.PROPERTY)
public class FormMapping {
	private String name;
	private List<View> views;
	
	@XmlAttribute(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@XmlElementWrapper(name="views")
	@XmlElement(name="view")
	public List<View> getViews() {
		return views;
	}

	public void setViews(List<View> views) {
		this.views = views;
	}
	
	public void addView(View view){
		if(views!=null){
			if(!views.contains(view)){
				views.add(view);
			}
		}else{
			views = new ArrayList<View>();
			views.add(view);
		}
	}
}
